<?php
class Monorel_model extends CI_Model
{
	function Monorel_model()
	{
		parent::Model();
	}
	
	public function __construct()
	{
	
	$this->load->database('jadwal');
	
	}

function tambah_monorel() {

	$data = array(
		'monorel' => $this->input->post('monorel'),
		'tujuan' => $this->input->post('tujuan'),
		'keterangan' => $this->input->post('keterangan')
		
	);
	
	return $this->db->insert('jadwal', $data);

}

function get_info() {

	$this->db->order_by('id_jadwal','ASC');
	
	$query = $this->db->query('SELECT * FROM jadwal ORDER BY id_jadwal ASC');
	
	if($query->num_rows() > 0)
	
	return $query;
	
	else
	
	return null;
		
}

function get_monorel_edit($id_jadwal) {

	$this->db->order_by('id_jadwal','ASC');
	$this->db->where('id_jadwal',$id_jadwal);
	$query = $getData = $this->db->get('jadwal');
	
	if($getData->num_rows() > 0)
	
	return $query;
	
	else
	
	return null;
		
}

function edit_monorel() {

	$id_jadwal = $this->input->post('id_jadwal');

	$data = array(

		'monorel' => $this->input->post('monorel'),
		'tujuan' => $this->input->post('tujuan'),
		'keterangan' => $this->input->post('keterangan')
		
	);
	
		$this->db->where('id_jadwal',$this->input->post('id_jadwal',$id_jadwal));
		$this->db->update('jadwal', $data);
		

}

function hapus_monorel($id_jadwal) {

		$this->db->where('id_jadwal',$id_jadwal);
		$this->db->delete('jadwal');
		
}



	
}